Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): avoid panic while updating progress #1597

Merged
merged 2 commits into from
Mar 20, 2024
Merged

fix(cli): avoid panic while updating progress #1597

merged 2 commits into from
Mar 20, 2024

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Mar 20, 2024

Summary

While installing new component, we are seeing a panic similar to:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x40 pc=0x10534999c]

goroutine 11 [running]:
github.com/lacework/go-sdk/cli/cmd.downloadProgress(0x14000820060?, {0x14000888120?, 0x0?}, 0x0)
	/codefresh/volume/go-sdk/cli/cmd/component.go:1177 +0x27c
github.com/lacework/go-sdk/cli/cmd.prototypeRunComponentsInstall.func1({0x14000888120?, 0x0?}, 0x1400005c8a0?)
	/codefresh/volume/go-sdk/cli/cmd/component.go:925 +0x34
created by github.com/lacework/go-sdk/lwcomponent.State.Install in goroutine 1
	/codefresh/volume/go-sdk/lwcomponent/component.go:279 +0x594

This is due to the fact that we were updating the progress Suffix unsafely. The fix is to use the
CLI functions to start a new progress every time we have an update inside the download func.

Additional things in this PR:

  • Fixed infinite loop when trying to install a component that is already installed
  • Added a make directive test-only to run only unit tests without prepare
  • Enabled HTTP Tracing to output more information about the EOF error we are seeing
  • A few styling improvements

How did you test this change?

Updated tests and ran multiple install and uninstall.

Issue

https://lacework.atlassian.net/browse/GROW-2765

Signed-off-by: Lacework <tech-ally@lacework.net>
@afiune afiune requested a review from a team as a code owner March 20, 2024 01:41
@PengyuanZhao
Copy link
Contributor

LGTM except the TestDownloadFile error.

Signed-off-by: Lacework <tech-ally@lacework.net>
@afiune afiune merged commit 570e578 into main Mar 20, 2024
11 checks passed
@afiune afiune deleted the afiune/GROW-2765 branch March 20, 2024 21:23
@lacework-releng lacework-releng mentioned this pull request Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants